/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package upc;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;


/**
 *
 * @author Darwin
 */
@Entity
@Table(name = "students")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Students.findAll", query = "SELECT s FROM Students s"),
    @NamedQuery(name = "Students.findByBirthdate", query = "SELECT s FROM Students s WHERE s.birthdate = :birthdate"),
    @NamedQuery(name = "Students.findByFirstname", query = "SELECT s FROM Students s WHERE s.firstname = :firstname"),
    @NamedQuery(name = "Students.findByIdBooster", query = "SELECT s FROM Students s WHERE s.idBooster = :idBooster"),
    @NamedQuery(name = "Students.findByLastname", query = "SELECT s FROM Students s WHERE s.lastname = :lastname")})
public class Students implements Serializable {
    private static final long serialVersionUID = 1L;
    @Column(name = "birthdate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date birthdate;
    @Size(max = 15)
    @Column(name = "firstname")
    private String firstname;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "idBooster")
    private String idBooster;
    @Size(max = 15)
    @Column(name = "lastname")
    private String lastname;

    public Students() {
    }

    public Students(String idBooster) {
        this.idBooster = idBooster;
    }

    public Date getBirthdate() {
        return birthdate;
    }

    public void setBirthdate(Date birthdate) {
        this.birthdate = birthdate;
    }

    public String getFirstname() {
        return firstname;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    public String getIdBooster() {
        return idBooster;
    }

    public void setIdBooster(String idBooster) {
        this.idBooster = idBooster;
    }

    public String getLastname() {
        return lastname;
    }

    public void setLastname(String lastname) {
        this.lastname = lastname;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idBooster != null ? idBooster.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Students)) {
            return false;
        }
        Students other = (Students) object;
        if ((this.idBooster == null && other.idBooster != null) || (this.idBooster != null && !this.idBooster.equals(other.idBooster))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "upc.Students[ idBooster=" + idBooster + " ]";
    }
    
}
